
var app = getApp();
Page({
    data: {
        baseUrl: app.globalData.baseUrl,
        goodsData: [
            {
                name: "巴拉巴拉小魔仙鞋",
                image: "https://morefun-active-1.oss-cn-shanghai.aliyuncs.com/2022_vansdress_jd/goods/goods.png",
                price: 27.5
            }, {
                name: "巴拉巴拉小魔仙鞋",
                image: "https://morefun-active-1.oss-cn-shanghai.aliyuncs.com/2022_vansdress_jd/goods/goods.png",
                price: 27.5

            }, {
                name: "巴拉巴拉小魔仙鞋",
                image: "https://morefun-active-1.oss-cn-shanghai.aliyuncs.com/2022_vansdress_jd/goods/goods.png",
                price: 27.5
            }, {
                name: "巴拉巴拉小魔仙鞋",
                image: "https://morefun-active-1.oss-cn-shanghai.aliyuncs.com/2022_vansdress_jd/goods/goods.png",
                price: 27.5
            }, {
                name: "巴拉巴拉小魔仙鞋",
                image: "https://morefun-active-1.oss-cn-shanghai.aliyuncs.com/2022_vansdress_jd/goods/goods.png",
                price: 27.5
            }, {
                name: "巴拉巴拉小魔仙鞋",
                image: "https://morefun-active-1.oss-cn-shanghai.aliyuncs.com/2022_vansdress_jd/goods/goods.png",
                price: 27.5
            },
        ]
    },

    onLoad: function (option) {
        console.log('onLoad');
        console.log(option)
        this.setData({
            goodsData: JSON.parse(option.dataStr) 
        })
    },

    onDeleteClick(e) {
        let tempIndex = e.target.dataset.index
        let temp = this.data.goodsData;
        temp.splice(tempIndex, 1);
        this.setData({
            goodsData: temp
        })
    },

    onBuyClick(e) {
        jd.navigateToNative({
            dataParam: {
                url: 'openapp.jdmobile://virtual',
                params: {
                    category:"jump",
                    des:"productDetail",
                    skuId:"53765436327",
                    param:{}
                }
            }
        });
    }
});